﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CoyoEden.Web.Controls;
using CoyoEden.Models;
using System.Text;
using CoyoEden;

public partial class Views_AlbumPicsView : AlbumViewBase
{
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!Page.IsPostBack) {
			phAlbumPicList.Controls.Add(BuildPicList());
		}
	}

	private LiteralControl BuildPicList()
	{
		if (Pics==null||Pics.Count == 0) {
			return new LiteralControl("<h3>没有任何照片</h3>");
		};
		StringBuilder html = new StringBuilder();
		
		html.AppendFormat("<ul class=\"{0}\">",CssClass??"jqGalView");
		Pics.ForEach(p => {
			html.AppendFormat("<li><a href=\"{0}\"><img src=\"{1}\" alt=\"{2}\" width=\"{3}\" height=\"{4}\" border=\"0\"/></a></li>", p.AbsoluteUrl, string.Format("{0}&suffix={1}", p.AbsoluteUrl,string.Format("{0}x{1}",PicWidth,PicHeight)),p.Name,PicWidth,PicHeight);
		});
		html.Append("</ul>");

		return new LiteralControl(html.ToString());
	}
}
